import { createSlice } from '@reduxjs/toolkit'

export const cityslice = createSlice({
  name: 'counter',
  initialState: {
    mycity:[]
  },
  reducers: {
    // 点击添加城市,存储在仓库中
    addcity(store,{payload}){
        console.log('pay',payload)
        store.mycity=[...store.mycity,payload]
    }
   }
})
// 每个 case reducer 函数会生成对应的 Action creators
export const { addcity } = cityslice.actions

export default cityslice.reducer